
<template>
  <div class="container">
    <el-row :gutter="20">
      <el-col :span="12">
        <el-card>
          <part-charts :chart-data="partData"/>
        </el-card>
      </el-col>
      <el-col :span="12">
        <el-card>
          <progress-charts :percentage="percentage" :total="total" :remain="remain"/>
        </el-card>
      </el-col>
    </el-row>
  </div>

</template>
<script>
import partCharts from "./partCharts.vue";
import progressCharts from "./progressCharts.vue";
import {getChartsData} from "../../../api/piaopiao/bill";

export default {
  name: "billStatistic",
  components:{partCharts,progressCharts},
  data() {
    return {
      chart:null,
      partData:[],
      percentage:0,
      total:0,
      remain:0,
    }
  },
  mounted() {
    this.getChartsData()
  },
  beforeDestroy() {

  },
  watch: {

  },
  methods: {
    getChartsData() {
      getChartsData().then(res => {
        this.partData = res.data.partDTOS
        const total = res.data.total;
        const remain = res.data.remain;
        this.percentage = ((total - remain) / total * 100);
        console.log(this.percentage);
        this.total = total;
        this.remain = remain;
      })
    }
  }
}
</script>


<style scoped lang="scss">
.container {
  padding: 50px;
}
</style>
